package com.jf.listener;

import javax.servlet.ServletContext;
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
import javax.servlet.annotation.WebListener;

/**
 * Created with IntelliJ IDEA
 * Description:
 * User:22954
 * Date:2024-09-01
 * Time:22:12
 */
@WebListener
public class JFServletContextListener implements ServletContextListener {
    @Override
    public void contextInitialized(ServletContextEvent servletContextEvent) {
        ServletContext servletContext = servletContextEvent.getServletContext();
        String servletContextName = servletContext.getServletContextName();
        System.out.println("===================================================================================");
        System.out.println(servletContextName);
        System.out.println("servletContextEvent: " + servletContextEvent + " is initialized");
        System.out.println("===================================================================================");
    }

    @Override
    public void contextDestroyed(ServletContextEvent servletContextEvent) {
        System.out.println("===================================================================================");
        System.out.println("servletContextEvent: " + servletContextEvent + " is destroyed");
        System.out.println("===================================================================================");
    }
}
